//
//  UIImageView+ZJ.swift
//  ZJSwiftKit
//
//  Created by 左潇 on 2023/6/30.
//

import Foundation

// MARK: - Method
public extension ZJPrefix where Base: UIImageView {
    
    /// 毛玻璃效果
    ///
    /// - Parameter style: UIBlurEffectStyle (default is .light).
    func blur(withStyle style: UIBlurEffect.Style = .light) {
        let blurEffect = UIBlurEffect(style: style)
        let blurEffectView = UIVisualEffectView(effect: blurEffect)
        blurEffectView.frame = base.bounds
        blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] // for supporting device rotation
        base.addSubview(blurEffectView)
        base.clipsToBounds = true
    }

}
